<template>
    <div class="mySwiper">
        <swiper :options="swiperOption" v-if="swiperList.length">
            <!-- v-if用于解决页面最开始小圆点页面在最后一个，当获得的list里有内容才显示  --> 
            <swiper-slide v-for="item in swiperList" :key="item.id">
                <img class="swiper-img" :src="item.imgUrl" alt="">
            </swiper-slide>
            <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
    </div>
</template>


<script>
    export default{
        name:'HomeSwiper',
        data(){
            return{
               swiperOption:{
                   pagination:".swiper-pagination",      //用于分页小圆圈
                   loop:true                            //插件支持循环轮播
               }
            }
        },
        props:{
          swiperList:Array
        }
    }
</script>

<style lang="stylus" scoped>
    .mySwiper >>> .swiper-pagination-bullet-active      //穿透 因为swiper这个class是 sweiper自己的类在组件中看不到 所以用 》》》组件中就能看见 插件组件的类 就不受scoped限制
        background red !important
    .mySwiper
        overflow hidden
        width 100%
        height 0
        padding-bottom 31.25%
        .swiper-img
            width 100%
        .swiper-pagination-bullet-active
            background red
</style>